package com.acme.bankapp.domain.bank;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

public class Bank implements Serializable{
	private ArrayList<Client> clients = new ArrayList<>();
	private ClientRegisrationListener[] listeners = {new ClientRegisrationListener() {

		public void onClientAdded(Client c) {
			final SimpleDateFormat formatter = new SimpleDateFormat(
					"dd.MM.yyyy hh:mm");
			c.getClientSalutation();
			System.out.println(": " + "add at "
					+ formatter.format(new Date()));
		}
	}, new ClientRegisrationListener() {

		public void onClientAdded(Client c) {
			System.out.print("Notification email for client ");
			c.getClientSalutation();
			System.out.println(" to be send");
		}
	}};
	


	public Bank(ClientRegisrationListener... listeners) {
		this.listeners = listeners;
	}

	public Bank(ArrayList<Client> clients) {
		this.clients = clients;
	}

	public ArrayList<Client> getClients() {
		return clients;
	}

	public void setClients(Client client) {
		clients.add(client);
	}

	public ClientRegisrationListener[] getListeners() {
		return listeners;
	}
}

